package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	DepartmentId int     `gorm:"type:int(10);not null;comment:'科室Id'"`
	UserId       int     `gorm:"type:int(10);not null;comment:'用户Id'"`
	DocTorId     int     `gorm:"type:int(10);not null;comment:'医生Id'"`
	HospitalId   int     `gorm:"type:int(10);not null;comment:'医院Id'"`
	PatientId    int     `gorm:"type:int(10);not null;comment:'就诊人Id'"`
	OrderSn      string  `gorm:"type:varchar(100);not null;comment:'订单号'"`
	Price        float64 `gorm:"type:double(10,2);not null;comment:'价格'"`
	Status       int     `gorm:"type:int(10);not null;comment:'状态 : 1未支付 2：支付错误 3:支付完成 4:订单支付成功'"`
}

func CreateOrder(order *Order) error {
	return DB.Debug().Create(&order).Error
}

func OrderList() (result []*Order, err2 error) {
	DB.Debug().Find(&result)
	return
}
